// FrogExtractFolderDialog.cpp : Implementation of CFrogAboutDialog
#include "stdafx.h"
#include "FrogAboutDialog.h"

#include "..\FilesRefactor\FilesRefactor.h"
#include "..\FilerFrogUtils\FilerFrogUtils.h"

// CFrogAboutDialog

LRESULT CFrogAboutDialog::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	CFrogBaseDialog::OnInitDialog(uMsg, wParam, lParam, bHandled);

	m_FrogDotComLink.SubclassWindow(GetDlgItem(IDC_STATIC_FROG_LINK));
	FamFamFamDotComLink.SubclassWindow(GetDlgItem(IDC_STATIC_LINK_FAM));

	wstring userLicense = L"Registered to: Everyone";
	wstring license = L"License: Free User License";

	SetDlgItemText(IDC_STATIC_USER,	userLicense.c_str());
	SetDlgItemText(IDC_STATIC_LICENSE, license.c_str());			
	SetDlgItemText(IDC_EDIT_COPYRIGHT, L"Warning: This computer program is protected by copyright law\r\nand international treaties. Unauthorized reproduction or\r\ndistribution of this program, or any portion of it, may result in\r\nsevere civil and criminal penalties, and will be prosecuted to the\r\nmaximum extent possible under the law.");

	return 0;
}

LRESULT CFrogAboutDialog::OnClickedOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	bHandled = TRUE;
	// TODO: Add your control notification handler code here



	EndDialog(wID);
	return 0;
}
LRESULT CFrogAboutDialog::OnBnClickedButtonCheckUpdates(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	// Opens the update
	TCHAR szPath[MAX_PATH];

	if (GetModuleFileName(_AtlBaseModule.GetModuleInstance(), szPath, MAX_PATH))
	{
		wstring updateExePath = FilerFrogUtils::GetFileDirectoyPath(szPath) + L"\\FilerFrogUpdater.exe";
		ShellExecute(NULL, NULL, updateExePath.c_str(), NULL, NULL, SW_SHOWNORMAL);
		EndDialog(0);
	}
	else
	{
		FrogMessageBox(m_hWnd, L"Error loading FilerFrog Updater", L"FilerFrog - About", MB_ICONERROR);
	}

	return 0;
}
